package com.sky.mapper;

import com.sky.entity.Dish;
import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    void insertBatch(List<SetmealDish> setmealDishes);

    @Select("select * from setmeal_dish where setmeal_id= #{id}")
    List<SetmealDish> getSetmealIdsByDishId(Long id);

    @Delete("delete from setmeal_dish where setmeal_id= #{id}")
    void deleteByDishId(Long id);

    @Select("select d.* from dish d left join setmeal_dish sd on d.id = sd.dish_id where sd.setmeal_id = #{dishId}")
    List<Dish> getById(Long dishId);
}
